package service;

import dao.BookMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import pojo.Books;
import pojo.User;

import java.util.List;

@Service
public class BookServiceImp implements BookService{

    private BookMapper bookMapper;
    @Autowired
    public void setBookMapper(BookMapper bookMapper){
        this.bookMapper=bookMapper;
    }



    @Override
    public int updateMoney(String username,double tomoney) {
        return bookMapper.updateMoney(username,tomoney);

    }

    @Transactional
    @Override
    public void updateMoneyto(String username, String username2, double money) {

        bookMapper.updateMoney(username,money);
        int i= 3/0;
        bookMapper.updateMoney(username2,-money);
        return ;
    }


}
